package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/alert-data")
public class AlertDataController {
    @Autowired
    private AlertDataService alertDataService;
    @ApiOperation("分页查询报警数据")
    @GetMapping("/pageQuery")
    public ResponseResult<PageResponse<AlertDataVo>> pageQuery(AlertDataPageQueryDto alertDataPageQueryDto)
    {
        PageResponse<AlertDataVo> pageResponse =alertDataService.getAlertDataPage(alertDataPageQueryDto);
        return ResponseResult.success(pageResponse);
    }

    @ApiOperation("处理报警设备数据")
    @PutMapping("/handleAlertDate/{id}")
    public ResponseResult handleAlertDate(@PathVariable("id") Long id, @RequestBody AlertDataHandleDto alertDataHandleDto)
    {
        alertDataService.handleAlertDate(id,alertDataHandleDto);
        return ResponseResult.success();
    }
}
